Skip to content

Conversation

@adityacosmos24
Copy link
Contributor

Add Push/Email Notification System for Auction Events

Summary

Implements push and email notification endpoints to alert sellers on important auction events, ensuring sellers stay informed in real-time about new bids, auction expiry, and bid acceptance.

Features

  • Email Notifications: HTML email alerts using Nodemailer
  • Push Notifications: Firebase Cloud Messaging (FCM) support
  • REST API Endpoints: Get, mark as read, and manage notifications
  • Automatic Triggers: Notifications sent automatically on:
    • New bids placed on seller's auctions
    • Bid acceptance by seller
    • Auction expiring soon (24h before expiry)
    • Auction expired
  • Scheduled Jobs: Automated cron jobs check for expiring/expired auctions

API Endpoints

  • GET /api/notifications - Get all notifications (with pagination)
  • GET /api/notifications/unread-count - Get unread count
  • PATCH /api/notifications/:id/read - Mark notification as read
  • PATCH /api/notifications/read-all - Mark all as read
  • DELETE /api/notifications/:id - Delete notification

Technical Details

  • Email: Nodemailer with HTML templates
  • Push: Firebase Admin SDK (optional)
  • Scheduler: node-cron for automated expiry checks
  • Database: MongoDB notification model with read/unread tracking

Files Added

  • src/models/notification.model.ts
  • src/services/notification.service.ts
  • src/services/auctionScheduler.service.ts
  • src/controllers/notification.controller.ts
  • src/routes/notificationRoutes.ts

Files Modified

  • package.json - Added firebase-admin and node-cron
  • src/app.ts - Added notification routes
  • src/server.ts - Initialized scheduler
  • src/controllers/auction.controller.ts - Integrated notification triggers

Environment Variables

EMAIL_USER=[email protected]
EMAIL_PASS=your-app-password
FRONTEND_URL=http://localhost:3000
FIREBASE_SERVICE_ACCOUNT={...} # Optional

Testing

  • ✅ Notifications triggered on new bids
  • ✅ Notifications triggered on bid acceptance
  • ✅ Scheduled jobs for expiry notifications
  • ✅ API endpoints tested and working

Benefits

  • Enhanced seller engagement
  • Real-time auction updates
  • Improved user experience
  • Critical auction events never missed

@04shubham7 04shubham7 self-assigned this Nov 15, 2025
Copy link
Member

@04shubham7 04shubham7 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks Fine

@04shubham7 04shubham7 linked an issue Nov 15, 2025 that may be closed by this pull request
1 task
@04shubham7 04shubham7 merged commit 79f6077 into OPCODE-Open-Spring-Fest:main Nov 15, 2025
4 of 5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature]: Implement seller notifications for new bids and item sold

2 participants